package com.glory.erp.auth.emp.bean;

import java.util.HashMap;
import java.util.Map;
import java.util.Set;

import com.glory.erp.auth.dept.bean.Dept;
import com.glory.erp.auth.role.bean.Role;
import com.glory.erp.util.FormatUtil;

/**
 * @Description: 员工信息
 * @Title: Emp.java
 * @Author: 樊双峰
 * @Date: 2018年5月18日 上午12:51:38
 * @Version V1.0
 */
public class Emp {

	public static final String EMPINFO = "empLogin";
	public static final Integer EMP_MAN = 1;
	public static final Integer EMP_WOMAN = 0;
	public static final String EMP_MAN_VIEW = "男";
	public static final String EMP_WOMAN_VIEW = "女";
	
	public static final Map<Integer, String> genderMap = new HashMap<Integer, String>();
	
	static{
		genderMap.put(EMP_MAN, EMP_MAN_VIEW);
		genderMap.put(EMP_WOMAN, EMP_WOMAN_VIEW);
	}
	
	/**
	 * id
	 */
	private Long uuid;
	
	/**
	 * 用户名
	 */
	private String userName;
	
	/**
	 * 密码
	 */
	private String password;
	
	/**
	 * 姓名
	 */
	private String name;
	
	/**
	 * 邮箱
	 */
	private String email;
	
	/**
	 * 手机号
	 */
	private String tele;
	
	/**
	 * 住址
	 */
	private String address;
	
	/**
	 * 性别
	 */
	private Integer gender;
	
	/**
	 * 出生日期
	 */
	private Long birthday;
	
	/**
	 * 最后登录IP
	 */
	private String lastLoginIp;
	
	/**
	 * 登录次数
	 */
	private Integer loginTimes;
	
	/**
	 * 最后登录时间
	 */
	private Long lastLoginTime;
	
	/**
	 * 部门 多对一
	 */
	private Dept dept;
	
	/**
	 * 角色 多对多
	 */
	private Set<Role> roles;
	
	/*
	 * 视图值
	 * 1.定义一个String类型的变量，变量名是无法合理显示的字段的字段名+View
	 * 2.提供其get方法
	 * 3.在其对应的变量的set方法中对这个View值进行初始化
	 */
	private String birthdayView;
	private String genderView;
	private String lastLoginTimeView;
	
	// 辅助值
	private String resList;
	
	public Emp() {
	}

	public Emp(Long uuid, String userName, String password, String name,
			String email, String tele, String address, Integer gender,
			Long birthday, String lastLoginIp, Integer loginTimes,
			Long lastLoginTime, Dept dept, Set<Role> roles,
			String birthdayView, String genderView, String lastLoginTimeView) {
		this.uuid = uuid;
		this.userName = userName;
		this.password = password;
		this.name = name;
		this.email = email;
		this.tele = tele;
		this.address = address;
		this.gender = gender;
		this.birthday = birthday;
		this.lastLoginIp = lastLoginIp;
		this.loginTimes = loginTimes;
		this.lastLoginTime = lastLoginTime;
		this.dept = dept;
		this.roles = roles;
		this.birthdayView = birthdayView;
		this.genderView = genderView;
		this.lastLoginTimeView = lastLoginTimeView;
	}

	public Emp(Long uuid, String userName, String password, String name,
			String email, String tele, String address, Integer gender,
			Long birthday, String lastLoginIp, Integer loginTimes,
			Long lastLoginTime, String birthdayView, String genderView,
			String lastLoginTimeView) {
		this.uuid = uuid;
		this.userName = userName;
		this.password = password;
		this.name = name;
		this.email = email;
		this.tele = tele;
		this.address = address;
		this.gender = gender;
		this.birthday = birthday;
		this.lastLoginIp = lastLoginIp;
		this.loginTimes = loginTimes;
		this.lastLoginTime = lastLoginTime;
		this.birthdayView = birthdayView;
		this.genderView = genderView;
		this.lastLoginTimeView = lastLoginTimeView;
	}

	public Long getUuid() {
		return uuid;
	}

	public void setUuid(Long uuid) {
		this.uuid = uuid;
	}

	public String getUserName() {
		return userName;
	}

	public void setUserName(String userName) {
		this.userName = userName;
	}

	public String getLastLoginIp() {
		return lastLoginIp;
	}

	public void setLastLoginIp(String lastLoginIp) {
		this.lastLoginIp = lastLoginIp;
	}

	public Integer getLoginTimes() {
		return loginTimes;
	}

	public void setLoginTimes(Integer loginTimes) {
		this.loginTimes = loginTimes;
	}

	public Long getLastLoginTime() {
		return lastLoginTime;
	}

	public void setLastLoginTime(Long lastLoginTime) {
		this.lastLoginTime = lastLoginTime;
		this.lastLoginTimeView = FormatUtil.formatDate(lastLoginTime);
	}

	public String getPassword() {
		return password;
	}

	public void setPassword(String password) {
		this.password = password;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getEmail() {
		return email;
	}

	public void setEmail(String email) {
		this.email = email;
	}

	public String getTele() {
		return tele;
	}

	public void setTele(String tele) {
		this.tele = tele;
	}

	public String getAddress() {
		return address;
	}

	public void setAddress(String address) {
		this.address = address;
	}

	public Integer getGender() {
		return gender;
	}

	public void setGender(Integer gender) {
		this.gender = gender;
		this.genderView = genderMap.get(gender);
	}

	public Long getBirthday() {
		return birthday;
	}

	public void setBirthday(Long birthday) {
		this.birthday = birthday;
		this.birthdayView = FormatUtil.formatDate(birthday);
	}

	public Dept getDept() {
		return dept;
	}

	public void setDept(Dept dept) {
		this.dept = dept;
	}

	public String getBirthdayView() {
		return birthdayView;
	}

	public String getGenderView() {
		return genderView;
	}

	public String getLastLoginTimeView() {
		return lastLoginTimeView;
	}

	public Set<Role> getRoles() {
		return roles;
	}

	public void setRoles(Set<Role> roles) {
		this.roles = roles;
	}

	public String getResList() {
		return resList;
	}

	public void setResList(String resList) {
		this.resList = resList;
	}
}